#!/bin/bash

if [ $# -lt 1 ]; then
    echo "Usage: $0 port_number1 port_number2"
    echo "Ext: $0 80 8080"
    echo "Note: sometime you must run as root to found more port"
    exit 1
fi

PORT=""
for p in $@
do
    is_number=`echo $p | egrep "\<[0-9]+\>"`
    [ $is_number ] || continue;
    if [ $PORT ]; then
        PORT="$PORT,$p"
    else
        PORT=":$p"
    fi
done

lsof -b -n -P -T -M -i4$PORT
